package com.tcfvic.client.panels;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.VerticalSplitPanel;
import com.tcfvic.client.FundingSourceListService;
import com.tcfvic.client.FundingSourceListServiceAsync;
import com.tcfvic.client.panels.widgets.FundingSourceDetailsInputWidget;
import com.tcfvic.client.panels.widgets.FundingSourceDetailsListWidget;

public class FundingSourceDetailsForm {

	/**
	 * Create a remote service proxy to talk to the server-side PersonDetails
	 * service.
	 */
	private final FundingSourceListServiceAsync fundingSourceListService = GWT
			.create(FundingSourceListService.class);
	private VerticalSplitPanel vSplit = new VerticalSplitPanel();

	public FundingSourceDetailsForm(boolean editing) {
		// Create a Vertical Split Panel
		vSplit = new VerticalSplitPanel();
		vSplit.ensureDebugId("cwVerticalSplitPanel");
		vSplit.setSize("900px", "800px");
		vSplit.setSplitPosition("1%");

		FundingSourceDetailsInputWidget fundingSourceDetails = new FundingSourceDetailsInputWidget();
		FundingSourceDetailsListWidget fundingSourceListWidget = null;
		if (editing) {
			fundingSourceListWidget = new FundingSourceDetailsListWidget(
					fundingSourceListService, fundingSourceDetails);
			vSplit.setTopWidget(fundingSourceListWidget);
			vSplit.setSplitPosition("40%");
		}
		fundingSourceDetails
				.addFundingSourceDetailsList(fundingSourceListWidget);
		vSplit.setBottomWidget(fundingSourceDetails);

	}

	public VerticalSplitPanel getvSplit() {
		return vSplit;
	}
}
